﻿#include "widget.h"
#include "ui_widget.h"
#include<QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    initControl();
}

Widget::~Widget()
{
    delete ui;
    qDebug()<<"delete";
}

void Widget::initControl()
{
    QPalette palette;
    palette.setBrush(QPalette::Background,QBrush(QPixmap("./scene.jpg")));
    setPalette(palette);
    QPushButton* startBtn=new QPushButton(this);
    //startBtn->setFlat(true);
    startBtn->setFixedSize(70,50);
    startBtn->setText("开始游戏");
    startBtn->move(QPoint(width()/2-35,height()/2-25));
    startBtn->setStyleSheet(QString("background-color:orange;color:green;"));
    connect(startBtn,SIGNAL(clicked()),this,SLOT(slotStartBtnClicked()));
}

void Widget::slotStartBtnClicked()
{
    this->close();
    view* pic=new view();
    pic->show();
}

